{% extends 'Back/Sano/layout.content.html.twig' %}
{% block myJs %}
    <script type="text/javascript">
        var theForm = document.forms['form1'];
        if (!theForm) {
            theForm = document.form1;
        }

        function __doPostBack(eventTarget, eventArgument) {
            $("#__EVENTTARGET").val(eventTarget)
            $("#__EVENTARGUMENT").val(eventArgument)
            $("#form1").submit();
            return false;
            if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                console.log(eventTarget)
                console.log(eventArgument)
                theForm.__EVENTTARGET.value = eventTarget;
                theForm.__EVENTARGUMENT.value = eventArgument;
                theForm.submit();
            }
        }
        $(function () {
            $("#txtKeywords").on("keypress", function (event) {
                if (event.keyCode == 13) {
                    __doPostBack('lbtnSearch', '')
                    return false;
                }
            });
            $(".edit_val").on("keypress", function (event) {
                if (event.keyCode == 13) {
                    var id = $(this).data("id")
                    var name = $(this).data("name")
                    var selector = $(this).data("selector")
                    __doPostBack('setAttr','id='+id+'&'+name+'='+ $(selector).val())
                    return false;
                }
            });

        })
    </script>
{% endblock %}
{% block main %}

    <div style="">
        <div class="section-header">
            <h6>
                <div class="float-right">
                    <a class="btn btn-sm btn-outline-primary" href="javascript:location.reload()"> <i class="ion ion-refresh fs10"></i> </a>
                    <a class="btn btn-sm btn-outline-primary" href="javascript:parent.Page.close()"> <i class="ion ion-close fs10"></i> </a>
                </div>
                {{ title }}
            </h6>
        </div>
        <div class="row">
            <div class="col-12">
                {% block statistic %}
                    {#这里可以放一下统计数据类的东西#}
                {% endblock %}
                <form  method="get" class="layui-form"
                      action="{{ urls.toolUrl is defined ? urls.toolUrl : '' }}" id="form1">
                    {% block actionScript %}
                        <div class="aspNetHidden">
                            <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""/>
                            <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""/>
                        </div>

                    {% endblock %}
                    <div class="card">
                        <div class="card-header">
                            {% block toolbar -%}
                                <!--工具栏-->
                                <div class="flex-r">
                                    <div>
                                        {% block addBtn %}
                                            <a class="btn btn-outline-primary" href="{{ urls.addUrl is defined ? urls.addUrl : '' }}">
                                                <span class="fa fa-plus"></span> 新增
                                            </a>
                                        {% endblock %}

                                        {% block delBtn %}
                                            <div class="btn btn-outline-primary ml-2" id="ComListCheckAll">
                                                <span class="ion ion-android-checkbox-outline"></span>
                                                <span class="text">全选</span>
                                            </div>
                                            <div class="btn btn-outline-danger ml-2" id="ComListDelete">
                                                <span class="ion ion-trash-b"></span>
                                                <span class="text">删除</span>
                                            </div>
                                        {% endblock %}
                                    </div>
                                    <div class="flex1">
                                        {% block options %}
                                            <div class="menu-list padl20">
                                                {#{{ dump(tools) }}#}
                                                {% if tools is not defined %}
                                                    {% set tools = [] %}
                                                {% endif %}
                                                {% for key , classes in tools %}
                                                    {% set default = "请选择" %}
{#                                                    {% set classes = classes %}#}
                                                    <div class="rule-single-select layui-inline">
                                                        <select name="cond[{{ key }}]" onchange="javascript:__doPostBack('searchCond','')" >
                                                            <option value="" {{app.request.get("cond")[key] is defined and app.request.get("cond")[key] == "" ? ' selected="selected"' : "" }} >{{ default }}</option>
                                                            {% for class in classes %}
                                                                <option value="{{ class.id }}"
                                                                        {{app.request.get("cond")[key] is defined and  app.request.get("cond")[key] == class.id ? ' selected="selected"' : "" }}
                                                                >{{ class.name }}</option>
                                                            {% endfor %}
                                                        </select>
                                                    </div>
                                                {% endfor %}
                                            </div>
                                        {% endblock %}
                                    </div>
                                    <div class="flex-r">
                                        {% block searchBox %}
                                            <div class="input-group">
                                                <input id="txtKeywords" type="text" class="form-control" placeholder="请输入关键词" name="txtKeywords"
                                                       value="{{ app.request.get("txtKeywords") }}">
                                                <div class="input-group-btn">
                                                    <button onclick="__doPostBack('lbtnSearch','')" class="btn btn-primary"><i class="ion ion-search"></i></button>
                                                </div>
                                            </div>
                                        {% endblock %}
                                    </div>
                                </div>
                                <!--/工具栏-->
                            {% endblock %}
                            <div>
                                {% block toolsExt %}{% endblock %}
                            </div>
                        </div>
                        <div class="card-body">
                            <!--列表-->
                            <div class="table-responsive">
                                <table class="table table-striped">
{#                                    <tr>#}
                                        {% block tableHead %}
                                        {% endblock %}
{#                                    </tr>#}
                                    {#                            <tbody>#}
                                    {% block tableList %}
                                    {% endblock %}
                                    {#                            </tbody>#}

                                </table>
                            </div>
                            <!--/列表-->
                        </div>
                        {% block page %}
                            <div class="card-footer text-right">
                                <!--内容底部-->
                                <div class="line20"></div>
                                {% if page is defined %}
                                    <div class="pagelist flrc">
                                        <div class="flex1 tal">
                                            <span>显示</span>
                                            {{ page.perPage }}
                                            <span>条/页</span>

                                            <span>共 {{ page.total }} 条记录</span>
                                        </div>
                                        <div id="PageContent" class="">
                                            {{ page.page  | raw }}
                                        </div>
                                    </div>
                                {% endif %}
                                <!--/内容底部-->
                            </div>
                        {% endblock %}
                    </div>
                </form>

            </div>
        </div>
    </div>




{% endblock %}